package development;

import particle.core.tools.Color;
import state.AlertMenu;
import state.GameGlobal;
import state.component.MenuStyle;
import state.component.Style;
import state.component.TextFieldStyle;
import state.font.FontManager;
import state.util.GameColor;

public class Global extends GameGlobal {
  public static MenuStyle MENU_STYLE = null;
  public static Style CHECK_BOX_STYLE = null;
  public static TextFieldStyle TEXT_FIELD_STYLE = null;
  public static Style ALERT_MENU_STYLE = null;

  /**
   * Init all data here
   */
  public static void init() {
    TIME_OUT = 60 * 60 * 1000;
    initCheckboxStyle();
    initMenuStyle();
    initTextFieldStyle();
    initAlertMenuStyle();
    Global.nextState(FrmLogo.instance(), null);
    System.out.println("Global : init done");
  }

  private static void initCheckboxStyle() {
    CHECK_BOX_STYLE = new Style();
    CHECK_BOX_STYLE.setHasBorder(true);
    CHECK_BOX_STYLE.setBorderColor(GameColor.RED2_CODE);

    CHECK_BOX_STYLE.setFocusable(true);
    CHECK_BOX_STYLE.setForceGroundColor(GameColor.BLACK_CODE);
    CHECK_BOX_STYLE.setFocusFgColor(GameColor.WHITE_CODE);

    CHECK_BOX_STYLE.setFillBackGround(true);
    CHECK_BOX_STYLE.setBackgroundColor(GameColor.WHITE_CODE);
    CHECK_BOX_STYLE.setFocusBgColor(GameColor.GREEN_CODE);
  }

  private static void initMenuStyle() {
    MENU_STYLE = new MenuStyle();
    MENU_STYLE.setFillBackGround(false);
    MENU_STYLE.setFillFocusItemBg(true);
    MENU_STYLE.setFocusBgColor(0xA53A06);
    MENU_STYLE.setForceGroundColor(GameColor.WHITE_CODE);
    MENU_STYLE.setFocusFgColor(GameColor.WHITE_CODE);
    MENU_STYLE.setHasBorder(false);
    MENU_STYLE.setItemHeight(18);
    MENU_STYLE.setItemWidth(116);
    MENU_STYLE.setFont(FontManager.getFont(FontManager.FONT_SIZE_8));
    MENU_STYLE.setTextDx(5);
    MENU_STYLE.setTextDy(2);
  }

  private static void initTextFieldStyle() {
    TEXT_FIELD_STYLE = new TextFieldStyle();
    TEXT_FIELD_STYLE.setFillBackGround(true);
    TEXT_FIELD_STYLE.setBackgroundColor(GameColor.BLACK_CODE);
    TEXT_FIELD_STYLE.setHasBorder(true);
    TEXT_FIELD_STYLE.setBorderColor(Color.Black);
    TEXT_FIELD_STYLE.setForceGroundColor(GameColor.BLACK_CODE);
    TEXT_FIELD_STYLE.setFont(FontManager.getFont(FontManager.FONT_SIZE_11));
    TEXT_FIELD_STYLE.setAlign(TextFieldStyle.ALIGN_LEFT);
    TEXT_FIELD_STYLE.setFocusable(true);
    TEXT_FIELD_STYLE.setFocusBgColor(0xFDFBB7);
    TEXT_FIELD_STYLE.setFocusFgColor(GameColor.BLACK_CODE);
  }

  private static void initAlertMenuStyle() {
    ALERT_MENU_STYLE = new Style();
    ALERT_MENU_STYLE.setBackgroundColor(0xD0A736);
    ALERT_MENU_STYLE.setBorderColor(GameColor.WHITE_CODE);
    ALERT_MENU_STYLE.setForceGroundColor(GameColor.WHITE_CODE);
    ALERT_MENU_STYLE.setFocusFgColor(0x7F0300);
    ALERT_MENU_STYLE.setFocusBgColor(GameColor.GREEN_CODE);
    ALERT_MENU_STYLE.setFont(FontManager.getFont(FontManager.FONT_SIZE_8));
    AlertMenu.setStyle(ALERT_MENU_STYLE);
  }

  public static void initBeforeStart() {
  }
}
